package edu.ubb.scrumster.model.model;

public class Task implements AbstractModel{
	int id;
	UserStory userStory;
	String description;
	User user;
	String status;

	public Task(UserStory userStory, String description, User user,
			String status) {
		super();
		this.userStory = userStory;
		this.description = description;
		this.user = user;
		this.status = status;
	}

	public Task(int id, UserStory userStory, String description, User user,
			String status) {
		super();
		this.id = id;
		this.userStory = userStory;
		this.description = description;
		this.user = user;
		this.status = status;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public UserStory getUserStory() {
		return userStory;
	}

	public void setUserStory(UserStory userStory) {
		this.userStory = userStory;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getObjectType() {
		return "Task";
	}
	
	public void validate() throws ModelException{
		if (this.userStory==null){
			throw new ModelException("There is no userStory");
		}
		if (this.description.equals("") || this.description.isEmpty()){
			throw new ModelException("The task description is empty");
		}
	}

}
